import { TIME_STAMP, TIME_TIMEOUT_VALUE } from '@/constant/index'
import { getItem, setItem } from '@/utils/storage'

/* 获取时间戳 */
export function getTimeStamp () {
  return getItem(TIME_STAMP)
}

/* 设置时间戳 */
export function setTimeStamp () {
  setItem(TIME_STAMP, Date.now())
}

/* 是否超时 */
export function isCheckTimeOut () {
  const currentTime = Date.now()
  const timeStamp = getTimeStamp()
  return currentTime - timeStamp > TIME_TIMEOUT_VALUE
}